package com.example.spirngbootyaml.pojo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author 墨苍璃
 * @date 2022年01月12日17时13分
 * @Component 注册bean到容器中
 * @ConfigurationProperties作用：将配置文件中配置的每一个属性的值， 映射到这个组件中；告诉SpringBoot将本类中的所有属性和配置文件中相关的配置进行绑定参数 prefix = “person” :
 * 将配置文件中的person下面的所有属性一一对应
 */
@Component
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
//@ConfigurationProperties(prefix = "person")
@Validated
public class Person {

    @Email(message = "邮箱格式不正确")
    private String name;
    private Integer age;
    private Boolean happy;
    private Date birth;
    private Map<String, Object> maps;
    private List<Object> lists;
    private Dog dog;
}